package com.oocl.o2o.client.dao.impl;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Repository;

import com.oocl.o2o.client.dao.FoodTypeDao;
import com.oocl.o2o.client.entity.FoodType;

/**
 * @description: 
 * @author  XIEMI2
 * @date Aug 12, 2017 7:56:10 PM
 * @version 1.0
 */
@Repository
public class FoodTypeDaoImpl implements FoodTypeDao{

	@PersistenceContext(name="un")
	private EntityManager em;
	
	@Override
	public FoodType findById(String id) {
		FoodType foodType = em.find(FoodType.class, id);
		return foodType;
	}

	@Override
	public List<FoodType> findAll() {
		String jpql = "from FoodType";
		List<FoodType> foodTypes = em.createQuery(jpql).getResultList();
		return foodTypes;
	}

}


